package com.pack5.mapper;

import com.pack5.pojo.Class;
import org.apache.ibatis.annotations.*;

/**
 * @author lenove
 * @description 针对表【c_class】的数据库操作Mapper
 * @createDate 2024-11-15 11:31:00
 * @Entity com.pojo.Cclass
 */
public interface ClassMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Class record);

    int insertSelective(Class record);

    Class selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Class record);

    int updateByPrimaryKey(Class record);

    @Select("SELECT * FROM c_class WHERE id = #{cla}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "classname", column = "classname")
    })
    Class selectClassById(int id);
    @Select("SELECT * FROM c_class WHERE id = #{id}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "classname", column = "classname"),
            @Result(column = "id",property = "studentsList",
                    many = @Many(select = "com.mapper.StudentsMapper.selectStudentsById"))
    })
    Class selectClassaById(int id);
}